export function endLoop(iteratorObj, callback) {
  if (!iteratorObj?.length) {
    return []
  }

  return new Promise((resolve, reject) => {
    Array.prototype.forEach.call(iteratorObj, (item) => {
      if (callback(item) === true) {
        resolve(true)
        throw Error('End loop')
      }
    })

    reject()
  })
}
